<template>
	<view class="">
		<view class="headTop">
			<view class=" u-flex u-p-l-30 u-p-t-30 u-p-b-30">
				<view class="u-m-r-10">
					<image :src="avatar" style="width: 100rpx;height: 100rpx;border-radius: 100rpx;"
						@click="goNavs('/pages/my/userinfo')"></image>
				</view>
				<view class="flex justify-between align-center u-m-l-10 text-white" v-if="!isLogin" style="width: 75%;">
					<view class="margin-right-sm ">
						<view class="u-font-18  text-bold flex align-center">
							{{userName}}
							<image v-if="iconImg" :src="iconImg" style="width: 30rpx;height: 30rpx;margin-left: 20rpx;"
								mode="widthFix">
							</image>
						</view>
						<view class="text-sm margin-top-xs" v-if="XCXIsSelect != '否'">
							<view v-if="geRen == 0" @click.stop="goNav('/my/renzheng/types')" style="color: #666666">
								未入驻
							</view>
							<view v-else-if="geRen == 1"
								@click.stop="goNav('/my/renzheng/index?authentication='+authentication)"
								style="color: #666666">
								审核中
							</view>
							<view v-else-if="geRen == 2" style="color: #666666;">
								已入驻
							</view>
							<view v-else-if="geRen == 3"
								@click.stop="goNav('/my/renzheng/index?authentication='+authentication)"
								style=" color: #666666;">
								已拒绝
							</view>
						</view>
					</view>
					<view v-if="!isLogin" class="" @click="goNav('/pages/msg/message')">
						<image src="../../static/images/my/messages.png" style="width: 45upx;height: 52rpx;" mode="">
						</image>
					</view>
				</view>
				<view v-else class="text-xl u-p-l-20 text-bold" @click="goLogin('/pages/public/login')">
					登录
				</view>
			</view>
		</view>

		<!-- 统计 -->
		<view class="tj" v-if="XCXIsSelect != '否'">
			<view class="tj-box">
				<view class="tj-box-l" @click="goNav('/my/wallet/index')">
					<view class="tj-box-l-t">今日收入</view>
					<view class="tj-box-l-num">
						<span>{{money?money:'0'}}</span>元
					</view>
					<view class="tj-box-l-s">今日收入金额</view>
				</view>
				<view class="tj-box-r">
					<view class="tj-box-r-t">订单统计</view>
					<view class="tj-box-r-num">
						<span>{{ordercount?ordercount:'0'}}</span>单
					</view>
					<view class="tj-box-r-s">今日完成单量</view>
				</view>
			</view>
		</view>
		<view class="tj" style="margin-top: 20rpx;" v-if="XCXIsSelect != '否'">
			<view class="tj-box">
				<view class="tj-box-l" @click="goNav('/my/creditScore/creditScore')">
					<view class="tj-box-l-t">我的信用分</view>
					<view class="tj-box-l-num">
						<span>{{creditScore?creditScore:'0'}}</span>分
					</view>
					<view class="tj-box-l-s">当前信用分</view>
				</view>
				<view class="tj-box-r" @click="goNav('/my/creditScore/jilu')">
					<view class="tj-box-r-t">我的评分</view>
					<view class="tj-box-r-num">
						<span>{{finalScore?finalScore:'0'}}</span>
					</view>
					<view class="tj-box-r-s">当前评分</view>
				</view>
			</view>
		</view>
		<view class="bg margin radius">
			<view class="flex padding-lr padding-tb dfs" v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/online.png" style="width:52upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">接单状态</view>
				<u-switch v-model="online" @change="isOnline" :loading="loading"></u-switch>
			</view>
			<view class="flex padding-lr padding-tb dfs" @click.stop="goNav('/my/wallet/index')"
				v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/qianbao.png" style="width:52upx;height: 45upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">我的钱包</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<view class="flex padding-lr padding-tb dfs"
				@click.stop="goNavs('/my/renzheng/index?authentication='+authentication)" v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/shiming.png" style="width:52upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">实名认证</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- <view class="flex padding-lr padding-tb dfs" @click.stop="goNav('/my/renzheng/index')" v-if="XCXIsSelect != '否'"> -->

			<view class="flex padding-lr padding-tb dfs" @click="goNav('/my/wallet/baozhengjin')"
				v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/baozhengjin.png" style="width: 48upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">保证金</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<view class="flex padding-lr padding-tb dfs" @click="goNav('/my/bindMerchant/index')"
				v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/bangding.png" style="width: 48upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">绑定管理</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>

			<view class="flex padding-lr padding-tb dfs" @click="goNav('/my/team/team')" v-if="tuiguangK !='否'">
				<image src="../../static/images/my/tg.png" style="width: 48upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">推广中心</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<view class="flex padding-lr padding-tb dfs" @click="goNav('/pages/my/invitationUser')"
				v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/fx.png" style="width: 48upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">邀请好友</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>

			<!-- 	<view class="flex padding-lr padding-tb dfs" @click="goNav('/pages/msg/message')">
				<image src="../../static/images/my/messages.png" style="width: 48upx;height: 45upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">系统消息</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view> -->
			<view class="flex padding-lr padding-tb dfs" @click="Changekefu()" v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/kefu.png" style="width: 52upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">联系客服</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<view class="flex padding-lr padding-tb dfs" @click.stop="goNav('/my/feedbackIndex/feedbackIndex')"
				v-if="XCXIsSelect != '否'">
				<image src="../../static/images/my/help.png" style="width:50upx;height: 45upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">帮助中心</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<view class="flex padding-lr padding-tb" @click="goNav('/my/setting/index')">
				<image src="../../static/images/my/set.png" style="width: 52upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">设置中心</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view>
			<!-- <view class="flex padding-lr padding-tb" @click="goNav('/my/bindMerchant/index')">
				<image src="../../static/images/my/set.png" style="width: 52upx;height: 52upx;" mode=""></image>
				<view class="flex-sub margin-left text-df" style="line-height: 50upx;">测试</view>
				<image src="../../static/images/my/right.png" class="images" mode=""></image>
			</view> -->
		</view>
		<u-popup v-model="showAvatar" border-radius="14" width="600" :closeable="true" mode="center">
			<view class="showAvatar-title">
				个人信息
			</view>
			<view class="showAvatar-line">
				个人形象照
			</view>
			<view class="showAvatar flex justify-center flex-wrap">
				<view class="showAvatar-uploud flex justify-center align-center">
					<view @click="uploudAvatarImg()" v-if="!avatarImg" class="" style="text-align: center;">
						<u-icon name="camera" color="#8f8f94" size="60"></u-icon>
						<view class="showAvatar-uploud-txt">
							上传个人形象照
						</view>
					</view>
					<image @click="uploudAvatarImg()" v-else :src="avatarImg"
						style="width: 100%;height: 100%;border-radius: 14rpx;" mode=""></image>

				</view>
			</view>
			<view class="showAvatar-line">
				服务项目
			</view>
			<view class="showAvatar-list">
				<u-checkbox-group>
					<u-checkbox v-model="item.checked" v-for="(item, index) in employList" :key="index"
						:name="item.name">{{item.name}}</u-checkbox>
				</u-checkbox-group>
			</view>
			<view class="showAvatar-line" style="margin-top: 10rpx;">
				自我介绍
			</view>
			<view class="showAvatar-txt">
				<u-input placeholder="请输入自我介绍" style="background-color: #F5F5F5;padding: 0 20rpx;" v-model="myDetails"
					type="textarea" :border="false" :height="100" :auto-height="false" />
			</view>
			<view class="showAvatar-submit">
				<view @click="saveAvaratImg" class="showAvatar-submit-box flex justify-center align-center">
					确认
				</view>
			</view>
			<view class="showAvatar-bottom"></view>
		</u-popup>
	</view>
</template>

<script>
	import config from '../../common/config.js'
	export default {
		data() {
			return {
				myDetails: '',
				employList: [],
				loading: false,
				// 中间变量，避免在watch中多次回调，造成无限循环
				controlStatus: false,
				online: false,
				avatar: '../../static/logo.png',
				isLogin: true,
				userName: '匿名',
				ordercount: '', //订单
				money: 0, ///今日收入
				userId: '',
				isVip: false,
				invitationCode: '', //邀请码
				geRen: 0,
				XCXIsSelect: '否',
				renzheng: false,
				classify: 1,
				authentication: 1,
				arr: [],
				arr1: [],
				showModal: true,
				creditScore: 0, //信用分
				rate: 0, //当前分成比例
				finalScore: '0', //当前评分
				iconImg: '',
				avatarImg: '', //师傅形象照
				showAvatar: false, //上传师傅形象照
				isSafetyMoney: '',
				tuiguangK: '否'
			}
		},
		onLoad() {
			this.XCXIsSelect = this.$queue.getData("XCXIsSelect");
			this.tuiguangK = uni.getStorageSync('tuiguangK')
			this.classify = uni.getStorageSync("classify")
		},
		onShow() {
			if (uni.getStorageSync("geRen")) {
				this.geRen = uni.getStorageSync("geRen")
				if (this.geRen == 2) {
					this.renzheng = false
				} else {
					this.renzheng = true
				}
			}

			this.userId = uni.getStorageSync('userId')
			if (this.userId) {
				// #ifdef MP-WEIXIN
				//订阅
				this.$Request.getT('/app/common/type/312').then(res => { //订单变更通知 312
					if (res.code == 0) {
						if (res.data && res.data.value) {
							this.arr.push(res.data.value)
						}
					}
				})




				this.$Request.getT('/app/common/type/311').then(res => { //师傅端转账通知 311
					if (res.code == 0) {
						if (res.data && res.data.value) {
							this.arr1.push(res.data.value)
						}
					}
				})


				this.$Request.getT('/app/common/type/352').then(res => { //绑定通知 352
					if (res.code == 0) {
						if (res.data && res.data.value) {
							this.arr.push(res.data.value)
						}
					}
				})


				if (this.showModal) {
					this.openMsg()
				}
				// #endif
				this.isLogin = false
				this.getUserInfo()
				this.getAmount()
				this.getIsVip()
			} else {
				this.isLogin = true
				this.userName = '匿名'
				this.ordercount = 0
				this.money = 0
				this.avatar = '../../static/logo.png'
				this.creditScore = 0 //信用分
				this.rate = 0 //当前分成比例
				this.finalScore = '0' //当前评分
				this.iconImg = ''
			}

		},
		methods: {
			//获取服务列表
			getEmployList() {

				let data = {
					authentication: this.authentication
				}

				this.$Request.getT('/app/hospitalEmploy/getEmployList', this.authentication != 2 ? data : '').then(res => {
					if (res.code == 0) {
						let arrs = []
						res.data.map(item => {
							let obj = {
								name: item.serviceName,
								checked: false,
								disabled: false,
								serviceId: item.serviceId
							}
							arrs.push(obj)
						})
						this.employList = arrs
						this.showAvatar = true
					} else {
						this.employList = []
						this.showAvatar = true
					}
				})
			},



			// 保存个人形象照
			saveAvaratImg() {
				let serviceIds = []
				this.employList.map(item => {
					if (item.checked) {
						serviceIds.push(item.serviceId)
					}
				})

				let data = {
					avatar: this.avatarImg,
					serviceIds: serviceIds.join(','),
					details: this.myDetails
				}
				if (!data.avatar) {
					uni.showToast({
						title: '请上传个人形象照',
						icon: 'none'
					})
					return
				}
				if (!data.serviceIds) {
					uni.showToast({
						title: '请选择服务项目',
						icon: 'none'
					})
					return
				}
				if (!data.details) {
					uni.showToast({
						title: '请输入自我介绍',
						icon: 'none'
					})
					return
				}
				uni.showLoading({
					title: '保存中...'
				})
				this.$Request.postT('/app/userCertification/setRealRealInfo', data).then(res => {
					uni.hideLoading()
					if (res.code == 0) {
						uni.showToast({
							title: '保存成功!'
						})
						this.showAvatar = false
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})

			},
			//上传个人形象照
			uploudAvatarImg() {
				let that = this
				//选择图片
				uni.chooseImage({
					sourceType: ['camera', 'album'],
					sizeType: 'compressed',
					count: 1,
					success: res => {
						//循环上传图片
						for (let i = 0; i < res.tempFilePaths.length; i++) {
							that.$queue.showLoading("上传中...");
							uni.uploadFile({ // 上传接口
								url: config.APIHOST1 + '/alioss/upload', //真实的接口地址
								// url: 'https://peizhensf.xianmaxiong.com/sqx_fast/alioss/upload',
								filePath: res.tempFilePaths[i],
								name: 'file',
								success: (uploadFileRes) => {
									that.avatarImg = (JSON.parse(uploadFileRes.data).data)
									uni.hideLoading();
								}
							});
						}
					}
				});
			},
			//师傅上下线
			isOnline(val) {
				if (this.userId) {
					if (this.geRen == 2 || this.geRen == 3) {
						if (!val) { //原状态为开启，现在关闭
							this.online = true
							this.loading = true
							if (!this.controlStatus) {
								this.controlStatus = true
								this.getRestultFromServer()
							}
						} else { //原状态为关闭，现在开启
							this.online = false
							this.loading = true
							if (!this.controlStatus) {
								this.controlStatus = true
								this.getRestultFromServer()
							}
						}
					} else if (this.geRen == 1) {
						if (!val) { //原状态为开启，现在关闭
							this.online = true
						} else { //原状态为关闭，现在开启
							this.online = false
						}
						uni.showModal({
							title: '提示',
							content: '实名认证审核中,请稍等',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									// uni.navigateTo({
									// 	url: '/my/renzheng/index'
									// })
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						if (!val) { //原状态为开启，现在关闭
							this.online = true
						} else { //原状态为关闭，现在开启
							this.online = false
						}
						uni.showModal({
							title: '提示',
							content: '您还未实名认证,请先认证',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									// uni.navigateTo({
									// 	url: '/my/renzheng/index?classify=' + this.classify
									// })
									uni.navigateTo({
										url: '/my/renzheng/types'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					}
				} else {
					if (!val) { //原状态为开启，现在关闭
						this.online = true
					} else { //原状态为关闭，现在开启
						this.online = false
					}
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}

			},
			getRestultFromServer() {
				let data = {
					shopState: this.online == true ? 0 : 1,
				}
				this.$Request.postJson('/app/user/updateUser', data).then(res => {
					if (res.code == 0) {
						this.getUserInfo()
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			},
			openMsg() {
				console.log('订阅消息')

				var that = this


				uni.getSetting({
					withSubscriptions: true, //是否获取用户订阅消息的订阅状态，默认false不返回
					success(ret) {
						console.log(ret.subscriptionsSetting, '------------------')
						// if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting.itemSettings).length == 2) {
						if (ret.subscriptionsSetting.itemSettings && Object.keys(ret.subscriptionsSetting
								.itemSettings).indexOf(that.arr[0]) > -1) {
							uni.setStorageSync('sendMsg', true)
							uni.openSetting({ // 打开设置页 
								success(rea) {
									console.log(rea.authSetting)
								},
								fail(fail) {
									console.log(fail);
								}
							});




						} else { // 用户没有点击“总是保持以上，不再询问”则每次都会调起订阅消息
							uni.setStorageSync('sendMsg', false)
							uni.showModal({
								title: '提示',
								content: '为了更好的体验,请绑定消息推送',
								confirmText: '确定',
								cancelText: '取消',
								success: function(res) {
									if (res.confirm) {
										uni.requestSubscribeMessage({
											tmplIds: that.arr,
											success(re) {
												console.log(JSON.stringify(re),
													'++++++++++++++')
												var datas = JSON.stringify(re);
												if (datas.indexOf("accept") != -1) {
													console.log(re)
													// uni.setStorageSync('sendMsg', true)
												}
											},
											fail: (res) => {
												console.log(res)
											}
										})

										that.showModal = false
									} else if (res.cancel) {
										console.log('取消')
										// uni.setStorageSync('sendMsg', false)
										that.showModal = true
									}
								}
							})
						}
					}
				})
			},
			Changekefu() {
				let SelKeFu = this.$queue.getData('SelKeFu');
				if (SelKeFu + '' == '1') { //手机号
					uni.makePhoneCall({
						phoneNumber: uni.getStorageSync('kefuPhone')
					});
				} else if (SelKeFu + '' == '2') { //企业微信
					let that = this
					// #ifdef MP-WEIXIN
					wx.openCustomerServiceChat({
						extInfo: {
							url: that.$queue.getData('kefu')
						},
						corpId: that.$queue.getData('kefuAppId'),
						success(res) {}
					})
					// #endif
					// #ifdef H5
					window.location.href = that.$queue.getData('kefu');
					// #endif
					// #ifdef APP
					let kefu = that.$queue.getData('kefu')
					console.log(kefu)
					plus.runtime.openURL(kefu, function(res) {});
					// #endif
				} else { //客服二维码页面
					uni.navigateTo({
						url: '/my/kefu/kefu'
					})
				}
			},
			// 跳转商户端
			goshop() {
				wx.navigateToMiniProgram({
					appId: 'wxfe0e405895cafdf9',
					path: '',
					envVersion: 'release', // 打开正式版
					success(res) {
						// 打开成功
					},
					fail: function(err) {
						console.log(err);
					}
				})
			},


			getZhuanZhang(e) {
				//师傅端转账通知
				console.log('订阅消息')
				var that = this
				uni.requestSubscribeMessage({
					tmplIds: that.arr1,
					success(re) {
						console.log(JSON.stringify(re),
							'++++++++++++++')
						var datas = JSON.stringify(re);
						if (datas.indexOf("accept") != -1) {
							console.log(re)
							// uni.setStorageSync('sendMsg', true)
						}
					},
					fail: (res) => {
						console.log(res, "1111111111111")
					}
				})
				uni.navigateTo({
					url: e
				})



			},



			goNav(e, name) {
				if (this.userId) {

					if (e == "/my/wallet/index") {
						this.getZhuanZhang(e)
					} else if (e == '/my/bindMerchant/index') {
						uni.requestSubscribeMessage({
							tmplIds: this.arr,
							success(re) {
								console.log(JSON.stringify(re), '++++++++++++++')
								var datas = JSON.stringify(re);
								if (datas.indexOf("accept") != -1) {
									console.log(re)
								}
							},
							fail: (res) => {
								console.log(res)
							}
						})
						uni.navigateTo({
							url: e
						})

					} else {
						uni.navigateTo({
							url: e
						})

					}


				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			},
			goNavs(e, name) {
				console.log(this.geRen)
				if (this.userId) {
					if (this.geRen == 2 || this.geRen == 3) {
						uni.navigateTo({
							url: e
						})
					} else if (this.geRen == 1) {
						uni.showModal({
							title: '提示',
							content: '实名认证审核中,请稍等',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									// uni.navigateTo({
									// 	url: '/my/renzheng/index'
									// })
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					} else {
						uni.showModal({
							title: '提示',
							content: '您还未实名认证,请先认证',
							success: function(res) {
								if (res.confirm) {
									console.log('用户点击确定');
									// uni.navigateTo({
									// 	url: '/my/renzheng/index?classify=' + this.classify
									// })
									uni.navigateTo({
										url: '/my/renzheng/types'
									})
								} else if (res.cancel) {
									console.log('用户点击取消');
								}
							}
						})
					}
				} else {
					uni.showModal({
						title: '提示',
						content: '您还未登录,请先登录',
						success: function(res) {
							if (res.confirm) {
								console.log('用户点击确定');
								uni.navigateTo({
									url: '/pages/public/login'
								})
							} else if (res.cancel) {
								console.log('用户点击取消');
							}
						}
					})
				}
			},
			goLogin(e) {
				uni.navigateTo({
					url: e
				})
			},
			getAmount() {
				this.$Request.get("/app/orders/selectOrdersCount").then(res => {
					if (res.code == 0) {
						this.money = res.data.money
						this.ordercount = res.data.counts
					}
				});
			},
			getUserInfo() {
				this.$Request.get("/app/user/selectUserById").then(res => {
					if (res.code == 0 && res.data) {
						this.userName = res.data.userName
						this.invitationCode = res.data.invitationCode
						this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
						this.isAuthentication = res.data.isAuthentication
						this.creditScore = res.data.creditScore //信用分
						this.rate = res.data.rate * 100 //当前分成比例
						this.finalScore = res.data.finalScore //师傅评分
						this.isSafetyMoney = res.data.isSafetyMoney //是否缴纳保证金
						//师傅在线状态
						uni.setStorageSync('shopState', res.data.shopState) //0:离线 1：在线
						if (res.data.shopState == 0) { //离线
							this.controlStatus = false;
							// 后端允许用户关闭switch，设置checked为false，结束loading状态
							this.loading = false;
							this.online = false
						} else { //在线
							this.controlStatus = false;
							// 后端允许用户关闭switch，设置checked为false，结束loading状态
							this.loading = false;
							this.online = true
						}
						//师傅等级
						this.iconImg = res.data.iconImg ? res.data.iconImg : ''
						console.log(res.data.rate, '222222222222')
						uni.setStorageSync('rate', res.data.rate)
						uni.setStorageSync('isAuthentication', res.data.isAuthentication)
						uni.setStorageSync('isAuthentication', res.data.isAuthentication)

						uni.setStorageSync('avatar', res.data.avatar)
						uni.setStorageSync('invitationCode', res.data.invitationCode)
						uni.setStorageSync('zhiFuBao', res.data.zhiFuBao)
						uni.setStorageSync('zhiFuBaoName', res.data.zhiFuBaoName)
						this.getRenZheng()
					}
				});
			},
			// 个人认证数据
			getRenZheng() {
				this.$Request.get("/app/userCertification/queryInsert").then(res => {
					console.log(res)
					if (res.code == 0) {
						if (res.data) {
							this.authentication = res.data.authentication
							uni.setStorageSync("city", res.data.city)
							uni.setStorageSync("authentication", res.data.authentication)
						}
						
						if (res.data == null) {
							this.geRen = 0
							uni.setStorageSync("geRen", this.geRen)
						} else if (res.data.status == 0) {
							this.geRen = 1
							uni.setStorageSync("geRen", this.geRen)
						} else if (res.data.status == 1) {
							this.geRen = 2
							uni.setStorageSync("geRen", this.geRen)
							if (!res.data.avatar || !res.data.serviceIds || !res.data.details) {
								let that = this
								uni.showModal({
									title: '提示',
									content: '为了提高您的接单量，请补全个人信息',
									complete(ret) {
										if (ret.confirm) {
											that.avatarImg = res.data.avatar
											that.myDetails = res.data.details
											that.getEmployList()

										}
									}

								})
							}
							if (this.isSafetyMoney != 1 || this.isSafetyMoney != '1') {
								uni.showModal({
									title: '提示',
									content: '缴纳保证金后才可以接单，请缴纳保证金',
									confirmText: '去缴纳',
									complete(ree) {
										if (ree.confirm) {
											uni.navigateTo({
												url: '/my/wallet/baozhengjin'
											})
										}
									}
								})
							}
						} else if (res.data.status == 2) {
							this.geRen = 3
							uni.setStorageSync("geRen", this.geRen)
						}
					}
				});
			},

			getIsVip() {
				this.$Request.get("/app/UserVip/isUserVip").then(res => {
					if (res.code == 0) {
						this.isVip = res.data
						uni.setStorageSync('isVIP', res.data)
					}
				});
			}

		}
	}
</script>

<style lang="scss">
	page {
		background: #F5F5F5;
	}

	.showAvatar-title {
		padding-top: 30rpx;
		// margin-top: 30rpx;
		width: 100%;
		text-align: center;
		font-weight: bold;
	}

	.showAvatar-line {
		// padding-left: 40rpx;
		margin-left: 40rpx;
		margin-top: 30rpx;
		padding-left: 10rpx;
		border-left: 3px solid #557EFD;
		font-weight: bold;
	}

	.showAvatar-list {
		width: 100%;
		// padding: 20rpx 40rpx 0 40rpx;
		padding-left: 40rpx;
		padding-right: 40rpx;
		margin-top: 20rpx;
	}

	.showAvatar-txt {
		padding-left: 40rpx;
		padding-right: 40rpx;
		margin-top: 20rpx;
	}

	.showAvatar-submit {
		margin-top: 30rpx;
		width: 100%;
		height: 80rpx;
		// margin-bottom: 30rpx;
		padding: 0 40rpx;

		.showAvatar-submit-box {
			width: 100%;
			height: 100%;
			background-color: #557EFD;
			border-radius: 14rpx;
			color: #ffffff;
		}
	}

	.showAvatar-bottom {
		width: 100%;
		height: 30rpx;
	}

	.showAvatar {
		width: 100%;
		// height: 100%;
		margin-top: 20rpx;
		align-content: flex-start;

		.showAvatar-uploud {
			width: 500rpx;
			height: 300rpx;
			// background-color: red;
			border: 1px dashed #8f8f94;
			border-radius: 14rpx;

			.showAvatar-uploud-txt {
				color: #8f8f94;
				margin-top: 20rpx;
			}
		}

		.showAvatar-submit {
			width: 500rpx;
			height: 80rpx;
			background-color: #557EFD;
			border-radius: 14rpx;
			color: #ffffff;
			margin-top: 30rpx;
			margin-bottom: 30rpx;
		}
	}

	.bg {
		background: #FFFFFF;
	}

	.headTop {
		background: linear-gradient(0deg, rgba(255, 255, 255, 0) 0%, #557EFD 100%);
		/* #ifdef APP */
		padding-top: 120upx;
		/* #endif */
	}

	.wode {
		// color: #FFFFFF;
		height: 100upx;
		display: flex;
		align-items: flex-end;
		justify-content: center;
		/* #ifdef H5 */
		font-size: 16px;
		margin-top: -30upx;
		/* #endif */
	}

	.camera {
		width: 54px;
		height: 44px;

		&:active {
			background-color: #ededed;
		}
	}

	.btn-bg {
		width: 64px;
		height: 28px;
		background: linear-gradient(90deg, #CDA26E 0%, #DCB78A 100%);
		border-radius: 28px;
		text-align: center;
		line-height: 28px;
		margin-top: 4px;
		color: '#604320'
	}

	.images {
		width: 18rpx;
		height: 30rpx;
	}

	.dfs {
		display: flex;
		align-items: center;
	}

	.lovip {
		width: 100rpx;
		height: 35rpx;
		position: relative;
		top: -39rpx;
	}

	.tj {
		width: 100%;
		height: 220rpx;
		display: flex;
		justify-content: center;

		.tj-box {
			width: 690rpx;
			height: 100%;
			background-color: #ffffff;
			border-radius: 20rpx;
			display: flex;

			.tj-box-l {
				width: 50%;
				height: 100%;

				.tj-box-l-t {
					width: auto;
					height: 28rpx;
					border-left: 6rpx solid #FE3B27;
					color: #333333;
					font-size: 28rpx;
					font-weight: bold;
					display: flex;
					align-items: center;
					padding-left: 10rpx;
					margin-top: 40rpx;
					margin-left: 40rpx;
				}

				.tj-box-l-num {
					color: #333333;
					font-size: 28rpx;

					span {
						font-size: 60rpx;
						margin-right: 10rpx;
					}

					margin-top: 10rpx;
					margin-left: 40rpx;
				}

				.tj-box-l-s {
					color: #B3B3B3;
					font-size: 22rpx;
					margin-top: 10rpx;
					margin-left: 40rpx;
				}
			}

			.tj-box-r {
				width: 50%;
				height: 100%;

				.tj-box-r-t {
					width: auto;
					height: 28rpx;
					border-left: 6rpx solid #009C66;
					color: #333333;
					font-size: 28rpx;
					font-weight: bold;
					display: flex;
					align-items: center;
					padding-left: 10rpx;
					margin-top: 40rpx;
					margin-left: 40rpx;
				}

				.tj-box-r-num {
					color: #333333;
					font-size: 28rpx;

					span {
						font-size: 60rpx;
						margin-right: 10rpx;
					}

					margin-top: 10rpx;
					margin-left: 40rpx;
				}

				.tj-box-r-s {
					color: #B3B3B3;
					font-size: 22rpx;
					margin-top: 10rpx;
					margin-left: 40rpx;
				}
			}
		}
	}
</style>